<template>
	<view class="index_content_basic">
		<view class="index_content_basic_main">
			<el-form :model="ruleForm" :rules="rules" label-position="top" ref="ruleForm" label-width="100px" class="demo-ruleForm">
				 <el-form-item label="期望工作性质" prop="lookingForwardNatureWork">
				 	<el-select v-model="ruleForm.lookingForwardNatureWork" placeholder="请选择期望工作性质" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardNatureWorkOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select>
				 </el-form-item>
				 <el-form-item label="期望从事行业" prop="lookingForwardIndustry">
				 	<el-select v-model="ruleForm.lookingForwardIndustry" placeholder="请选择期望从事行业" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardIndustryOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select>
				 </el-form-item>
				 <el-form-item label="期望薪资" prop="lookingForwardSalary">
				 	<el-select v-model="ruleForm.lookingForwardSalary" placeholder="请选择期望薪资" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardSalaryOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select>
				 </el-form-item>
				<!-- <el-form-item label="期望工作城市" prop="">
				 	<el-input v-model="ruleForm.idNumber" placeholder="请输入期望工作城市"></el-input>
				 </el-form-item> -->
				 <el-form-item label="求职状态" prop="jobSearchStatus">
				 	<el-select v-model="ruleForm.jobSearchStatus" placeholder="请选择期望求职状态" style="width: 100%;">
				 		<el-option v-for="item in jobSearchStatusOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select>
				 </el-form-item>
				 <el-form-item label="到岗时间" prop="arrivalTime">
				  <el-select v-model="ruleForm.arrivalTime" placeholder="请选择期望求职状态" style="width: 100%;">
				  	<el-option v-for="item in arrivalTimeOption" :label="item.dictLabel" :value="item.dictValue">
				  	</el-option>
				  </el-select>
				 </el-form-item>
			</el-form>
		</view>
		<view class="position_footer flex aic jcsb">
			<el-button class="blue_btn" style="width: 100%;" type="primary" @click="submitForm('ruleForm')">保存</el-button>
		</view>
	</view>
</template>

<script>
	import {
		editResume
	} from "@/api/my.js"
	export default {
		data() {
			return {
				ruleForm: {
					lookingForwardNatureWork:""
				},
				rules: {
					lookingForwardNatureWork: [{
							required: true,
							message: '请选择期望工作性质',
							trigger: 'blur'
						}
					],
					lookingForwardIndustry: [{
							required: true,
							message: '请选择期望从事行业',
							trigger: 'blur'
						}
					],
					lookingForwardSalary: [{
							required: true,
							message: '请选择期望薪资',
							trigger: 'blur'
						}
					],
					jobSearchStatus: [{
							required: true,
							message: '请选择求职状态',
							trigger: 'blur'
						}
					],
					arrivalTime: [{
							required: true,
							message: '请选择到岗时间',
							trigger: 'blur'
						}
					],
				},
				arrivalTimeOption:[]
			};
		},
		onLoad(options) {
			this.arrivalTimeOption = uni.getStorageSync("arrival_time")
			this.lookingForwardNatureWorkOption = uni.getStorageSync("position_nature")
			this.lookingForwardIndustryOption = uni.getStorageSync("company_industry")
			this.lookingForwardSalaryOption = uni.getStorageSync("salary")
			this.jobSearchStatusOption = uni.getStorageSync("status_of_job_hunting")
			this.datas = JSON.parse(options.data)
			this.info(this.datas)
		},
		methods: {
			info(data) {
				console.log("data:",data);
				this.ruleForm = data.personalInformation?data.personalInformation:{}
			},
			submitForm(formName) {
				this.$refs[formName].validate((valid) => {
					if (valid) {
						let obj = this.datas
						console.log(obj);
						obj.personalInformation = this.ruleForm
						editResume(obj)
					} else {
						this.$message({
							message: '请完善信息',
							type: 'error',
							offset: 0.1
						});
						console.log('error submit!!');
						return false;
					}
				});
			},
			resetForm(formName) {
				this.$refs[formName].resetFields();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.blue_btn {
		height: 40px;
		background: #2F6CBC;
		border: 1px solid #2F6CBC;
	}

</style>
